<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: AssessmentsHelper</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">AssessmentsHelper</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/app/helpers/assessments_helper_rb.html">
                app/helpers/assessments_helper.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000053">get_question</a>&nbsp;&nbsp;
      <a href="#M000052">set_answer_for_select</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">CASES</td>
          <td>=</td>
          <td class="context-item-value">{:first =&gt; &quot;Non avrai altro Dio al di fuori di me&quot;, :second =&gt; &quot;Non nominare il nome di Dio invano&quot;, :third =&gt; &quot;Ricordati di santificare le feste&quot;, :fourth =&gt; &quot;Onora il padre e la madre&quot;, :fifth =&gt; &quot;Non uccidere&quot;, :sixth =&gt; &quot;Non commettere atti inpuri&quot;, :seventh =&gt; &quot;Non rubare&quot;, :eighth =&gt; &quot;Non dire falsa testimonianza&quot;, :nineth =&gt; &quot;Non desiderare la donna d'altri&quot;, :tenth =&gt; &quot;Non desiderare la roba d'altri&quot;}</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
t.decimal :precision =&gt; 8, :scale =&gt; 2 change_column(table_name,
column_name, type, options): Changes the column to a different type using
the same parameters as add_column.

</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000053" class="method-detail">
        <a name="M000053"></a>

        <div class="method-heading">
          <a href="#M000053" class="method-signature">
          <span class="method-name">get_question</span><span class="method-args">(n)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Restituisce la domanda &quot;n&quot;esima.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000053-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/assessments_helper.rb, line 39</span>
39:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_question</span>(<span class="ruby-identifier">n</span>)
40:     <span class="ruby-identifier">translate_number</span>(<span class="ruby-identifier">n</span>)
41:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000052" class="method-detail">
        <a name="M000052"></a>

        <div class="method-heading">
          <a href="#M000052" class="method-signature">
          <span class="method-name">set_answer_for_select</span><span class="method-args">(q)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Restituisce l&#8216;insieme di risposte corrispondenti alla domanda q
specificata come parametro.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000052-source">
<pre>
    <span class="ruby-comment cmt"># File app/helpers/assessments_helper.rb, line 8</span>
 8:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_answer_for_select</span>(<span class="ruby-identifier">q</span>)
 9:     <span class="ruby-comment cmt"># weigth</span>
10:     <span class="ruby-comment cmt"># 3 =&gt; 6, 3, 0</span>
11:     <span class="ruby-comment cmt"># 4 =&gt; 6, 4, 2, 0</span>
12:     <span class="ruby-comment cmt"># 5 =&gt; 6, 4.5, 3, 1.5, 0</span>
13:     <span class="ruby-identifier">answer</span> = <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">q</span>.<span class="ruby-identifier">to_i</span>
14:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-comment cmt"># Non avrai altro Dio al di fuori di me</span>
15:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Ne ho avuti altri..&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Mi piace cambiare spesso&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
16:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span> <span class="ruby-comment cmt"># Non nominare il nome di Dio invano</span>
17:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Ho detto che berlusconi è innocente&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Quando m'arrabbio&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>], [<span class="ruby-value str">&quot;Se non bestemmio guarda...&quot;</span>, <span class="ruby-value str">&quot;4&quot;</span>], [<span class="ruby-value str">&quot;Lo uso come congiunzione&quot;</span>, <span class="ruby-value str">&quot;5&quot;</span>]]
18:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">3</span> <span class="ruby-comment cmt"># Ricordati di santificare le feste</span>
19:         [[ <span class="ruby-value str">&quot;Sempre&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Ne approfitto per dormire fino a tardi&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Quelle con gli amici?&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>], [<span class="ruby-value str">&quot;Sono un occasione per darmi all'alcool&quot;</span>, <span class="ruby-value str">&quot;4&quot;</span>]]
20:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">4</span> <span class="ruby-comment cmt">#Onora il padre e la madre</span>
21:         [[ <span class="ruby-value str">&quot;Sempre, li adoro&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;se non mi fanno arrabbiare&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;No&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
22:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">5</span> <span class="ruby-comment cmt"># Non uccidere</span>
23:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Qualcuno lo meriterebbe&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Ho appena finito di uccidere il vicino perchè faceva rumore...&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
24:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">6</span> <span class="ruby-comment cmt"># Non commettere atti inpuri</span>
25:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Come si fa?!&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;All'ordine del giorno...&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
26:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">7</span> <span class="ruby-comment cmt"># Non rubare</span>
27:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Da piccolo qualche cavolata l'ho commessa&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Il computer con cui sto scrivendo è rubato!&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
28:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">8</span> <span class="ruby-comment cmt"># Non dire falsa testimonianza.</span>
29:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Se serve...&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;No... Si... Smentisco...&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
30:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">9</span> <span class="ruby-comment cmt"># Non desiderare la donna d'altri</span>
31:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Però quante belle ragazze sprecate...&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Io non sono geloso!&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
32:       <span class="ruby-keyword kw">when</span> <span class="ruby-value">10</span> <span class="ruby-comment cmt"># Non desiderare la roba d'altri</span>
33:         [[ <span class="ruby-value str">&quot;Mai&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>], [<span class="ruby-value str">&quot;Scusa mi presteresti...&quot;</span>, <span class="ruby-value str">&quot;2&quot;</span>], [<span class="ruby-value str">&quot;Ucciderei per quel vestito!&quot;</span>, <span class="ruby-value str">&quot;3&quot;</span>]]
34:       <span class="ruby-keyword kw">end</span>
35:     <span class="ruby-identifier">select</span>(<span class="ruby-value str">&quot;assessment&quot;</span>, <span class="ruby-value str">&quot;q&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">q</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">answer</span>, { <span class="ruby-identifier">:include_blank</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;Scegli&quot;</span> }) <span class="ruby-keyword kw">unless</span> <span class="ruby-operator">!</span><span class="ruby-identifier">answer</span>
36:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>